- @meta = { :description => "#{@forum.name.capitalize} discussion forum.",:keywords => "#{@forum.tags.join(', ') if @forum.tags}",:robots => configatron.robots_meta_show_content}
- @section = 'forums'
- @page_title = @forum.name

-if admin?
  %p
    = link_to :back.l, forums_path, :class => 'btn btn-default'
    = link_to :edit.l, edit_forum_path(@forum), :class => 'btn btn-warning'
    = link_to :delete.l, forum_path(@forum), :method => 'delete', data: { confirm: :are_you_sure.l }, :class => 'btn btn-danger'

- unless @forum.description.blank?
  =@forum.description_html.html_safe
%p
  %a{:href => forum_sb_posts_path(@forum, :format => :rss)}
    =fa_icon "rss"
  = pluralize @forum.topics_count, :topic.l
  ,
  = pluralize @forum.sb_posts_count, :post.l


- if @forum.moderators.any?
  %h2= :moderators.l
  %ul.list-unstyled
    - @forum.moderators.each do |user|
      %li= link_to user.display_name, user_path(user)

- unless @topics.empty?
  %table.table.table-bordered.table-striped
    %tr
      %th
      %th= :topics.l
      %th= :posts.l
      %th= :view_count.l
      %th= :last_post.l

    - for topic in @topics
      %tr
        %td
          - icon, color, post = icon_and_color_and_post_for topic

          -if recent_topic_activity(topic)
            %span.badge
              =fa_icon "fire inverse"
        %td
          -if topic.sticky?
            %strong
              = link_to h(topic.title), forum_topic_path(@forum, topic), :class => "entry-title", :rel => "bookmark"
            .pull-right
              =fa_icon "thumb-tack fw"
          -else
            = link_to h(topic.title), forum_topic_path(@forum, topic), :class => "entry-title", :rel => "bookmark"
          -if topic.paged?
            %small= link_to :last.l, forum_topic_path(:forum_id => @forum, :id => topic, :page => topic.last_page)
          -if topic.locked?
            .pull-right
              =fa_icon "lock fw"
        %td= topic.sb_posts_count
        %td= number_with_delimiter(topic.views)
        %td
          %abbr{:title=>"#{topic.replied_at.xmlschema}"}= time_ago_in_words(topic.replied_at)
          %strong
            =:by.l :login => topic.replied_by_user.display_name
          %span= link_to :view.l, forum_topic_path(:forum_id => @forum, :id => topic, :page => topic.last_page, :anchor => "posts-#{topic.last_post_id}")

= paginate @topics, :theme => 'bootstrap'

- if logged_in?
  = link_to fa_icon('plus', :text => :post_a_new_topic.l.downcase.capitalize), new_forum_topic_path(@forum)
- else
  = link_to fa_icon('plus', :text => :log_in_to_create_a_new_topic.l.downcase.capitalize), new_forum_topic_path(@forum)

- if @topics.size < 10
  - @related = Post.limit(10).tagged_with(@forum.tag_list, :any => true)
  - unless @related.empty?
    %table.wide.topics{:border=>"0", :cellspacing=>"0", :cellpadding=>"0"}
      %tr
        %th.la{:colspan=>"2"}= :this_forum_is_still_getting_started.l
        %th{:width=>"1%"}= :comments.l
        %th{:width=>"1%"}= :view_count.l
        %th.la= :author.l
        -@related.each do |post|
          = render :partial => 'sb_posts/dummy_forum_post', :locals => {:post => post}
